Passed
Push — master ( 61dd3f...482d1b )
by greg
01:51
created

translate.js ➔ translate   B

Complexity

Conditions 5
Paths 2

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 5
c 1
b 0
f 0
nc 2
dl 0
loc 8
rs 8.8571
nop 2
1
import {Locales} from '../../../'
2
3
export default function translate(lang, str) {
4
  var trad = Locales.instance.i18n
5
  if(typeof trad[lang] !== 'undefined' && trad[lang] !== null
6
    && typeof trad[lang][str] !== 'undefined' && trad[lang][str] !== null) {
7
    return trad[lang][str]
8
  }
9
  return str
10
}
11
12